﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Castle.Windsor;
using WaterCooler.Infrastructure.Windsor;
using Wolfbyte.Core.InversionOfControl;
using Wolfbyte.Core.UnitOfWork;
using Wolfbyte.Core;

namespace WaterCooler
{
    public class GlobalApplication : UnitOfWorkApplication
    {
        public GlobalApplication()
        {
            Console.WriteLine("Foo");
        }

        protected void Application_Start()
        {
            InitializeIoC();
        }

        private void InitializeIoC()
        {
            var Container = new WindsorContainer("windsor.config");

            IoC.Initialize(new WindsorContainerWrapper(Container));
        }

        protected override IFactory<IUnitOfWork> UnitOfWorkFactory
        {
            get
            {
                return IoC.Resolve<IFactory<IUnitOfWork>>();
            }
        }
    }
}